﻿@model mvcForum.Web.ViewModels.ForumViewModel
@using CreativeMinds.MVC.Common.Helpers;
@using mvcForum.Web.Extensions;
@using mvcForum.Web.Helpers;
@{
	var iconName = String.Empty;
	if (Model.Unread) {
		iconName += "forum_unread";
	}
	else {
		iconName += "forum_read";
	}
	iconName += ".gif";

	var subForumList = String.Empty;
	if (Model.SubForums != null && Model.SubForums.Count > 0) {
		for (int index = 0; index < Model.SubForums.Count; index++) {
			if (index > 0) {
				subForumList += ", ";
			}
			subForumList += Html.ForumLink(Model.SubForums[index].Id, Model.SubForums[index].Name, null);
		}
	}
}
<li class="row">
	<dl class="icon" style="background-image: url(@Url.ForumImage(iconName)); background-repeat: no-repeat;">
		<dt title="No unread posts">
@if (Model.Accessible) {
			@Html.ForumLink(Model.Id, Model.Name, new { @class = "forumtitle" })
}
else {
			  <a class="forumtitle">@Model.Name @ForumHelper.GetString("NoAccess")</a>
}
			<br />@Model.Description
@if (!String.IsNullOrWhiteSpace(subForumList)) { 
			<text>Sub forums: </text>@Html.Raw(subForumList)
}</dt>
		<dd class="topics">@ForumHelper.GetHtmlString("TopicCount", new object[] {Model.TopicCount}) </dd>
		<dd class="posts">@ForumHelper.GetHtmlString("TopicCount", new object[] { Model.Posts }) </dd>
		<dd class="lastpost">@Html.Partial("LastTopicPartial", Model)</dd>
	</dl>
</li>
